.\"	$OpenBSD: SSL_get_ex_data_X509_STORE_CTX_idx.3,v 1.4 2019/06/08 15:25:43 schwarze Exp $
.\"	OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
.\"
.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
.\" Copyright (c) 2001 The OpenSSL Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\"
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in
.\"    the documentation and/or other materials provided with the
.\"    distribution.
.\"
.\" 3. All advertising materials mentioning features or use of this
.\"    software must display the following acknowledgment:
.\"    "This product includes software developed by the OpenSSL Project
.\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
.\"
.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
.\"    endorse or promote products derived from this software without
.\"    prior written permission. For written permission, please contact
.\"    openssl-core@openssl.org.
.\"
.\" 5. Products derived from this software may not be called "OpenSSL"
.\"    nor may "OpenSSL" appear in their names without prior written
.\"    permission of the OpenSSL Project.
.\"
.\" 6. Redistributions of any form whatsoever must retain the following
.\"    acknowledgment:
.\"    "This product includes software developed by the OpenSSL Project
.\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 8 2019 $
.Dt SSL_GET_EX_DATA_X509_STORE_CTX_IDX 3
.Os
.Sh NAME
.Nm SSL_get_ex_data_X509_STORE_CTX_idx
.Nd get ex_data index to access SSL structure from X509_STORE_CTX
.Sh SYNOPSIS
.In openssl/ssl.h
.Ft int
.Fn SSL_get_ex_data_X509_STORE_CTX_idx void
.Sh DESCRIPTION
.Fn SSL_get_ex_data_X509_STORE_CTX_idx
returns the index number under which the pointer to the
.Vt SSL
object is stored into the
.Vt X509_STORE_CTX
object.
.Pp
Whenever a
.Vt X509_STORE_CTX
object is created for the verification of the peer's certificate during a
handshake, a pointer to the
.Vt SSL
object is stored into the
.Vt X509_STORE_CTX
object to identify the connection affected.
To retrieve this pointer the
.Xr X509_STORE_CTX_get_ex_data 3
function can be used with the correct index.
This index is globally the same for all
.Vt X509_STORE_CTX
objects and can be retrieved using
.Fn SSL_get_ex_data_X509_STORE_CTX_idx .
The index value is set when
.Fn SSL_get_ex_data_X509_STORE_CTX_idx
is first called either by the application program directly or indirectly during
other SSL setup functions or during the handshake.
.Pp
The value depends on other index values defined for
.Vt X509_STORE_CTX
objects before the SSL index is created.
.Sh RETURN VALUES
.Bl -tag -width Ds
.It \(>=0
The index value to access the pointer.
.It <0
An error occurred, check the error stack for a detailed error message.
.El
.Sh EXAMPLES
The index returned from
.Fn SSL_get_ex_data_X509_STORE_CTX_idx
provides access to
.Vt SSL
object for the connection during the
.Fn verify_callback
when checking the peer's certificate.
Please check the example in
.Xr SSL_CTX_set_verify 3 .
.Sh SEE ALSO
.Xr CRYPTO_set_ex_data 3 ,
.Xr ssl 3 ,
.Xr SSL_CTX_set_verify 3
.Sh HISTORY
.Fn SSL_get_ex_data_X509_STORE_CTX_idx
first appeared in SSLeay 0.9.1 and has been available since
.Ox 2.6 .
